import tkinter
from Views  import InsertFrame, SearchFrame, AboutFrame, QueryFrame, DeleteFrame
class MainPage:
    def __init__(self,root2):
        self.root = root2
        self.root.title('学生信息管理系统V1.0')
        self.root.geometry('600x400')

        #自定义的一个组件
        self.insert_frame = InsertFrame(self.root)
        self.search_frame = QueryFrame(self.root)
        self.delete_frame = DeleteFrame(self.root)
        self.about_frame = AboutFrame(self.root)
     
        self.about_frame.pack()
        self.create_page()

    def create_page(self):
        menu_bar = tkinter.Menu(self.root)
        menu_bar.add_command(label='录入',command=self.show_insert_frame)
        menu_bar.add_command(label='查询',command=self.show_search_frame)
        menu_bar.add_command(label='删除',command=self.show_delete_frame)
        menu_bar.add_command(label='修改')
        menu_bar.add_command(label='关于',command=self.show_about_frame)

        self.root['menu'] = menu_bar     #  将菜单栏添加到窗口对象中

    def show_insert_frame(self):
        self.insert_frame.pack()
        self.search_frame.forget()
        self.about_frame.forget()
        self.delete_frame.forget()

    def show_search_frame(self):
        self.search_frame.pack()
        self.insert_frame.forget()
        self.about_frame.forget()
        self.delete_frame.forget()

    def show_delete_frame(self):
        self.delete_frame.pack()
        self.insert_frame.forget()
        self.search_frame.forget()
        self.about_frame.forget()

    def show_about_frame(self):
        self.about_frame.pack()
        self.insert_frame.forget()
        self.search_frame.forget()
        self.delete_frame.forget()





root  = tkinter.Tk()

MainPage(root)

root.mainloop()